'use strict';

const Controller = require('egg').Controller;

class LiveController extends Controller {
    // 获取直播管理列表
    async index() {
        const { ctx, app } = this;
        let { value = '', statu = '' } = ctx.request.body;
        const data = await app.mysql.query(`select * from live where title like '%${value}%' and statu like '%${statu}%'`);
        ctx.body = {
            code: 200,
            data
        }
    }

    // 直播管理删除
    async delete() {
        const { ctx, app } = this;
        const { id } = ctx.request.body;
        await app.mysql.delete('live', { id });
        ctx.body = {
            code: 200,
            mess: '删除成功'
        }
    }
   
}

module.exports = LiveController;
